package com.databaseconnectionmobilapi.domain.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import java.io.Serializable;
import java.time.LocalDateTime;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;

/**
 * <p>
 * 
 * </p>
 *
 * @author fall
 * @since 2022-01-17
 */
@Getter
@Setter
@Builder
@AllArgsConstructor
@NoArgsConstructor
@TableName("t_connection_db")
@ApiModel(value = "ConnectionDbEntity对象", description = "")
public class DatabaseEntity extends Model<DatabaseEntity> {

    private static final long serialVersionUID = 1L;

    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    @ApiModelProperty("用户id")
    @TableField("user_id")
    private Integer userId;

    @ApiModelProperty("连接名")
    @TableField("name")
    private String name;

    @ApiModelProperty("连接IP")
    @TableField("ip")
    private String ip;

    @ApiModelProperty("连接端口")
    @TableField("port")
    private String port;

    @ApiModelProperty("连接账号")
    @TableField("account")
    private String account;

    @ApiModelProperty("连接密码")
    @TableField("password")
    private String password;

    @ApiModelProperty("连接展示图片")
    @TableField("cover")
    private String cover;

    @ApiModelProperty("使用次数")
    @TableField("times")
    private Integer times;

    @ApiModelProperty("创建时间")
    @TableField(value = "create_time", fill = FieldFill.INSERT)
    private LocalDateTime createTime;

    @ApiModelProperty("更新时间")
    @TableField(value = "update_time", fill = FieldFill.INSERT_UPDATE)
    private LocalDateTime updateTime;

    @ApiModelProperty("逻辑删除 0 => 未删除 1=> 删除")
    @TableField("is_delete")
    @TableLogic
    private Integer isDelete;

    @ApiModelProperty("数据库类型 0 => mysql  1 => redis")
    @TableField("type")
    private Integer type;

    @Override
    public Serializable pkVal() {
        return this.id;
    }

}
